//
//  UIViewController+SSO.h
//  jiajia
//
//  Created by rujia chen on 16/5/1.
//  Copyright © 2016年 sunrisin. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "JJHttpClient.h"

@interface UIViewController (SSO)

/**
 *  获取验证码
 *
 *  @param mobile         手机号
 *  @param purpose        目的
 *  @param successBlock   成功回调
 *  @param failBlock      失败回调
 *  @param exceptionBlock 异常回调
 *
 *  @return sessionTask
 */
- (NSURLSessionTask*)gainCaptchaWithMobile:(NSString*)mobile
                                andPurpose:(JJCaptchaPurpose)purpose
                              successBlock:(SuccessBlock)successBlock
                                 failBlock:(FailBlock)failBlock
                            exceptionBlock:(ExceptionBlock)exceptionBlock;

/**
 *  注册
 *
 *  @param uid            用户id
 *  @param password       密码
 *  @param captcha        短信验证码
 *  @param successBlock   成功回调
 *  @param failBlock      失败回调
 *  @param exceptionBlock 异常回调
 *
 *  @return sessionTask
 */
- (NSURLSessionTask*)doRegisterWithID:(NSString*)uid
                          andPassword:(NSString*)password
                           andCaptcha:(NSString*)captcha
                         successBlock:(SuccessBlock)successBlock
                            failBlock:(FailBlock)failBlock
                       exceptionBlock:(ExceptionBlock)exceptionBlock;

/**
 *  登录
 *
 *  @param uid            用户id
 *  @param password       密码
 *  @param successBlock   成功回调
 *  @param failBlock      失败回调
 *  @param exceptionBlock 异常回调
 *
 *  @return sessionTask
 */
- (NSURLSessionTask*)doLogInWithID:(NSString*)uid
                       andPassword:(NSString*)password
                      successBlock:(SuccessBlock)successBlock
                         failBlock:(FailBlock)failBlock
                    exceptionBlock:(ExceptionBlock)exceptionBlock;

/**
 *  退出登录
 *
 *  @param successBlock   成功回调
 *  @param failBlock      失败回调
 *  @param exceptionBlock 异常回调
 *
 *  @return sessionTask
 */
- (NSURLSessionTask*)doLogOutWithSuccessBlock:(SuccessBlock)successBlock
                                    failBlock:(FailBlock)failBlock
                               exceptionBlock:(ExceptionBlock)exceptionBlock;

@end
